package com.balloon.springboot.datasource.persistence.service;


import com.balloon.springboot.datasource.entity.DataSourcePropertiesBean;
import com.balloon.springboot.datasource.persistence.dao.DataSourceDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.util.List;

/**
 * 数据源持久化
 */
@Service
public class DataSourceService {
    @Autowired
    DataSourceDao datasourceDao;

    public long saveDataSource(DataSourcePropertiesBean dataSourcePropertiesBean) throws SQLException {
        return datasourceDao.save(dataSourcePropertiesBean);
    }

    public long deleteDataSource(int id) throws SQLException {
        return datasourceDao.delete(id);
    }

    public List<DataSourcePropertiesBean> findDataSourceAll() throws SQLException {
        return datasourceDao.findAll();
    }
}
